<?php
class Master_saudara extends CI_Model 
{

	function __construct()
	{
		parent::__construct();
	}
	
	function add($dataInsert)
	{
		$query = $this->db->insert('mr_saudara', $dataInsert);
		return $query;
	}
		
	function edit($id_mr_saudara)
	{
		$this->db->where('id_mr_saudara',$id_mr_saudara);
		$query=$this->db->get('mr_saudara');
		return $query->result();
	}
	
	function update($id_mr_saudara,$dataInsert)
	{
		$this->db->where('id_mr_saudara', $id_mr_saudara);
		$update = $this->db->update('mr_saudara', $dataInsert);
		return $update;
	}
	
	function delete($id_mr_saudara)
	{
		$this->db->where('id_mr_saudara', $id_mr_saudara);
		$delete = $this->db->delete('mr_saudara');
		return $delete;
	}
	
	function detail($nis)
	{
		$this->db->where('nis',$nis);
		$this->db->_protect_identifiers = FALSE;
		$this ->db->order_by('FIELD( hubungan, "Kakak", "Adik" )');
		$this->db->_protect_identifiers = TRUE;
		$query=$this->db->get('mr_saudara');
		return $query->result();
	}
	
}